package com.rst.contacts;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Calendar3 {
	private static void doSimpleDateFormat() {
		Calendar now = Calendar.getInstance();
		SimpleDateFormat formatter = new SimpleDateFormat("MMMM yyyy");
		System.out.print(" \n It is now : " + formatter.format(now.getTime()));
		int month = now.get(Calendar.MONTH);
		System.out.println(month+1);
	}

	public static void CalendarDemo() {
		
		Calendar now = Calendar.getInstance();
		SimpleDateFormat formatter = new SimpleDateFormat("MMMM yyyy");
		System.out.print(" \n It is now : " + formatter.format(now.getTime()));
		int month = now.get(Calendar.MONTH);
		System.out.println(month+1);
		

		int daysInMonth = now.getActualMaximum(Calendar.DAY_OF_MONTH); // 28
		
		for(int i = 1;i<=daysInMonth;i++){
			now.set(Calendar.DAY_OF_MONTH, i);
			SimpleDateFormat formatter1 = new SimpleDateFormat("E");
			System.out.print(i);
			System.out.print(""+ formatter1.format(now.getTime()));
			System.out.print(" ");
						
		}
	}
	
	public static void main(String[] args) {
		//CalendarDemo(2014,01);
		//doSimpleDateFormat();
		CalendarDemo();
	}
}